/**
 * 执行终端命令相关的函数
 */

const { spawn } = require("child_process");

const commandSpawn = (...args) =>
  new Promise((resolve, reject) => {
    const childProcess = spawn(...args);
    childProcess.stdout.pipe(process.stdout);
    childProcess.stderr.pipe(process.stderr);
    childProcess.on("close", () => {
      resolve()
    });
  });

module.exports = {
  commandSpawn
};
